package com.dalei.vds.soap;

import com.dalei.vds.settings.ServerSettings;

import android.content.Context;

public class BaseSoap {

	// The name space of the web service
	public static final String NAMESPACE = "http://webservice.vdserver.dalei.com/";

	public static final String DEFAULT_IP_ADDRESS = "192.168.1.128";

	public static final int DEFAULT_PORT = 8080;

	public static final int DEFAULT_TIMEOUT = 10000;

	// The server host
	private String ipAddress = null;

	// The server port
	private int port = 0;

	// Connection timeout
	private int timeout = 0;

	public BaseSoap(String ipAddress, int port, int timeout) {
		this.ipAddress = ipAddress;
		this.port = port;
		this.timeout = timeout;
	}

	public BaseSoap(Context context) {
		// TODO Auto-generated constructor stub
		ServerSettings settings = new ServerSettings(context);
		if (settings.isSet()) {
			ipAddress = settings.getIpAddress();
			port = settings.getPort();
			timeout = settings.getTimeout();
		} else {
			ipAddress = DEFAULT_IP_ADDRESS;
			port = DEFAULT_PORT;
			timeout = DEFAULT_TIMEOUT;
		}
	}

	public String getIpAddress() {
		return ipAddress;
	}

	public void setIpAddress(String ipAddress) {
		this.ipAddress = ipAddress;
	}

	public int getPort() {
		return port;
	}

	public void setPort(int port) {
		this.port = port;
	}

	public int getTimeout() {
		return timeout;
	}

	public void setTimeout(int timeout) {
		this.timeout = timeout;
	}
}
